package com.tiger.statefulsb.sample3;

import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;

public class Sample3Client {
    public static void main(String args[]) {
        try {
            InitialContext ctx = new InitialContext();
            Object obj = ctx.lookup("comp/env/ejb/ShoppingCartBean03");
            ShoppingCartHome shoppingCartHome =
            (ShoppingCartHome)PortableRemoteObject.narrow(
            obj, ShoppingCartHome.class);
            
            ShoppingCart shoppingCart = shoppingCartHome.create(10);
            for(int i = 0; i < 11; i++) {
                shoppingCart.add("テレビ", 49800);
            }
            shoppingCart.remove();
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
}
